# < edited by the ViSa Modpack Team >

from CvPythonExtensions import *
import CvActionButtonUtils

CvActionButtonUtils = CvActionButtonUtils.CvActionButtonUtils()

gc = CyGlobalContext()
def doAction(argsList):
	pUnit, eAction = argsList
	action = gc.getActionButtonInfo(eAction)
	eval(action.getPyResult())
	CyInterface().setDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT, True)

def canDoAction(argsList):
	pUnit, eAction, bTestVisible = argsList
	action = gc.getActionButtonInfo(eAction)
	req = action.getPyRequirement()
	if(req == None or req == ""): 
		return True
	return eval(req)
